﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class D04_OnGUI : MonoBehaviour
{
    private string userName = "";
    public float volume = 0;//音量
    //自动布局
    private void OnGUI()
    {
        GUILayout.Label("英雄联盟");

        GUILayout.BeginHorizontal();//开始横向布局
        GUILayout.Label("请输入角色名:");
        userName = GUILayout.TextField(userName, GUILayout.MinWidth(100));//最小宽度100像素
        GUILayout.EndHorizontal();//结束横向布局

        if (GUILayout.Button("开始游戏"))
        {
            Debug.LogFormat("欢迎{0}来到英雄联盟", userName);
        }
        //滑动条(一般用来控制音量)
        volume = GUILayout.HorizontalSlider(volume, 0, 1f);
    }
}